﻿using System;
using System.Collections.Generic;

namespace MinimalistFoodStreet.BackEnd.Infrastructure.EFCore;

/// <summary>
/// 订单表
/// </summary>
public partial class Order
{
    /// <summary>
    /// r,u,d-编号
    /// </summary>
    public int OId { get; set; }

    /// <summary>
    /// c,r,u-商家（引用business）
    /// </summary>
    public int OBusinessId { get; set; }

    /// <summary>
    /// c,r,u-供应商（引用suppliers）
    /// </summary>
    public int OSupplierId { get; set; }

    /// <summary>
    /// r-订单编号
    /// </summary>
    public string OOrderId { get; set; } = null!;

    /// <summary>
    /// c,r,u-订单状态(0:未接单,1:待发货,2:已发货,3:全部完成,4:部分完成,-1:供应商拒绝接单(当前状态为未接单),-2:商家取消(当前状态为未发货或未接单),-3:供应商取消(当前状态为未发货)),-4:已拒收(当前状态为已发货)
    /// </summary>
    public int OStatus { get; set; }

    /// <summary>
    /// r,u-接单时间
    /// </summary>
    public DateTime? OAcceptOrderTime { get; set; }

    /// <summary>
    /// r,u-发货时间
    /// </summary>
    public DateTime? OSendTime { get; set; }

    /// <summary>
    /// r,u-完成时间
    /// </summary>
    public DateTime? OCompleteTime { get; set; }

    /// <summary>
    /// r,u-拒绝时间(所有负数状态都视为拒绝)
    /// </summary>
    public DateTime? ORefuseTime { get; set; }

    /// <summary>
    /// r,u-应付金额
    /// </summary>
    public decimal? OShouldPayMoney { get; set; }

    /// <summary>
    /// r,u-实付金额
    /// </summary>
    public decimal? OPayMoney { get; set; }

    /// <summary>
    /// r,u-供应商备注
    /// </summary>
    public string? OSupplierMarkup { get; set; }

    /// <summary>
    /// r,u-商家备注
    /// </summary>
    public string? OBusinessMarkup { get; set; }

    /// <summary>
    /// r-创建时间
    /// </summary>
    public DateTime OCreateTime { get; set; }

    public virtual Businesss OBusiness { get; set; } = null!;

    public virtual Supplier OSupplier { get; set; } = null!;

    public virtual ICollection<OrderDetail> OrderDetails { get; set; } = new List<OrderDetail>();
}
